package com.hd.trans.files.holder;

import android.view.View;
import android.widget.CheckBox;

import androidx.annotation.NonNull;

import com.hd.trans.R;
import com.hd.trans.files.bean.Audio;

import java.util.List;

public class MediaPathViewHolder extends BaseViewHolder {

    private final CheckBox mCheckBox;

    public MediaPathViewHolder(@NonNull View itemView) {
        super(itemView);
        mCheckBox = getView(R.id.file_path_cb);
    }

    /**
     * 显示音频的 时间 文件大小 时长 信息
     */
    public void showAudioExtraInfo(Audio audio) {
        //修改时间
//        String date = DateFormatUtil.getDate(audio.getTimes());
//        // 时长
//        String duration = DateFormatUtil.formatAudioTime(audio.getDurations());
//        // 文件大小
//        String size = FileSizeUtils.formatSize(audio.getSize());
//        if (audio.isDir()) {
//            setText(R.id.file_path_tv_date, date);
//        } else {
//            String extraInfo = date + "   " + size + "   " + duration;
//            setText(R.id.file_path_tv_date, extraInfo);
//        }
    }

    public void showCheckBox(Audio audio, List<Audio> selectedAudios) {
//        setViewGone(R.id.file_path_cb, audio.isDir());
//        setViewGone(R.id.file_path_iv_arrow, !audio.isDir());
        mCheckBox.setChecked(selectedAudios.contains(audio));
    }

    public void showFolder(boolean isFolder) {
//        setViewGone(R.id.file_path_cb, isFolder);
//        setViewGone(R.id.file_path_iv_arrow, !isFolder);
//        if (isFolder) {
//            setImageRes(R.id.file_path_iv_icon, R.drawable.icon_list_folder_blue);
//        } else {
//            setImageRes(R.id.file_path_iv_icon, R.drawable.icon_media_list_video);
//        }
    }

    public void checked(boolean checked) {
        mCheckBox.setChecked(checked);
    }
}
